package com.longcai.piaojia.conn;

import com.zcx.helper.http.AsyCallBack;
import com.zcx.helper.http.note.HttpInlet;

import org.json.JSONObject;

/**
 * Created by Administrator on 2017/1/10.
 */
@HttpInlet(Conn.ACTIVITY_SUBSCRIBE_DATE)
public class LatestOrderDateGet extends BaseAsyGet<LatestOrderDateGet.OrderTimeEntity> {

    public String id;

    public LatestOrderDateGet(AsyCallBack<OrderTimeEntity> asyCallBack) {
        super(asyCallBack);
    }

    @Override
    protected OrderTimeEntity parser(JSONObject object) throws Exception {

        TOAST = object.optString("message");

        if (object.optInt("code") == 200) {

            JSONObject mainObject = object.optJSONObject("data");

            OrderTimeEntity orderTime = new OrderTimeEntity();

            orderTime.starttime = mainObject.optString("starttime");
            orderTime.endtime = mainObject.optString("endtime");

            return orderTime;
        }

        return null;
    }

    public class OrderTimeEntity {

        public String starttime, endtime;

    }

    /*
    * {
    "code": 200,
    "data": {
        "starttime": "2017-01-10",
        "endtime": "2017-01-30"
    }
}*/
}
